using System.Collections.Generic;

namespace Voodoo.Sauce.Internal.Ads
{
	public static class MoPubWrapper
	{
		private const string TAG = "MoPubWrapper";

		private static List<string> _loadedAdUnits = new List<string>();

		public static void LoadBannerPluginsForAdUnits(string adUnit)
		{
			if (ContainsAdUnit(adUnit))
			{
				VoodooLog.LogW("MoPubWrapper", $"Ad unit for banner {adUnit} has already been loaded.");
				return;
			}
			MoPubAndroid.LoadBannerPluginsForAdUnits(new string[1]
			{
				adUnit
			});
			_loadedAdUnits.Add(adUnit);
		}

		public static void LoadInterstitialPluginsForAdUnits(string adUnit)
		{
			if (ContainsAdUnit(adUnit))
			{
				VoodooLog.LogW("MoPubWrapper", $"Ad unit for interstitial {adUnit} has already been loaded.");
				return;
			}
			MoPubAndroid.LoadInterstitialPluginsForAdUnits(new string[1]
			{
				adUnit
			});
			_loadedAdUnits.Add(adUnit);
		}

		public static void LoadRewardedVideoPluginsForAdUnits(string adUnit)
		{
			if (ContainsAdUnit(adUnit))
			{
				VoodooLog.LogW("MoPubWrapper", $"Ad unit for rewarded video {adUnit} has already been loaded.");
				return;
			}
			MoPubAndroid.LoadRewardedVideoPluginsForAdUnits(new string[1]
			{
				adUnit
			});
			_loadedAdUnits.Add(adUnit);
		}

		private static bool ContainsAdUnit(string adUnit)
		{
			return _loadedAdUnits.Contains(adUnit);
		}
	}
}
